const sequelize = require("../app/db");
const { DataTypes, Model } = require("sequelize");

class Chapter extends Model {}
Chapter.init(
  {
    Id: {
      type: DataTypes.INTEGER,
      allowNull: false, //不允许为空
      primaryKey: true,
      autoIncrement: true,
    },
    LessonId: {
      type: DataTypes.INTEGER,
    },
    Title: {
      type: DataTypes.STRING,
    },
    Sort: {
      type: DataTypes.INTEGER,
    }
  },
  {
    sequelize,
    modelName: "Chapter",
    tableName: "chapter", //强制设置表名
  }
);

module.exports = Chapter;
